package com.whj.apipassenger.controller;

import com.whj.apipassenger.service.UserService;
import com.whj.internalcommon.dto.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @Auther: wanghaijun
 * @Date: 2023/1/4 - 01 - 04 - 13:10 
 * @Description: com.whj.apipassenger.controller
 */

@RestController
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/users")
    public ResponseResult getUsers(HttpServletRequest request){

        //从http中获取accessToken
        String accessToken = request.getHeader("Authorization");

        return userService.getUserByToken(accessToken);
    }
}
